<!--
* description: 电话（含图标）
* author: zxuan
* createdDate: 2019-11-12
-->
<template>
  <section class="crmCallandMsg">
    <el-col :span="span">
     
        <lableName    :validrule="validrule"         :curLabelName="curLabelName" :isShowLabel="isShowLabel" :isRequire="isRequire"></lableName>
        <el-input
          :style="setInputWidth(span)"
          :placeholder="readonly ? '' : '请输入'"
          v-model="modelCode"
          :disabled="disabled"
          :readonly="readonly"
          size="small"
        
          @clear="clearCodeSelect"
          clearable
          resize="none"
          @blur="sendCode1"
          :type="inputType"
        ></el-input>
      <validateFormate :curLabelName="curLabelName" :validrule="validrule"></validateFormate>
      <!-- <el-col :span="6" style="font-size:20px;padding-left:0px;padding-right:0px;width:17%">
        <i class="icon-button el-icon-phone-crm el-icon-phone" @click="outcall"></i>
        <i class="el-icon-message-crm el-icon-message" @click="sendMessg"></i>
        
      </el-col> -->
    </el-col>
    <call ref="call"></call>
    <sendMsg ref="sendMsg"></sendMsg>
  </section>
</template>
<script>
import { searchInputMixins } from "@/components/mixins/searchInputMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
// import lableName from "@/components/lableName";
import call from "@/components/crm/crmEjectWindows/crmCallandMsg/call";
import sendMsg from "@/components/crm/crmEjectWindows/crmCallandMsg/sendmsg";
// import validateFormate from "@/components/validateFormate";
export default {
  // 组件混入对象
  mixins: [searchInputMixins, valueObjectMixins],
  components: {
    call,
    sendMsg,
    lableName: () => import("@/components/lableName"), //标题溢出样式组件
    validateFormate: () => import("@/components/validateFormate"), //校验提示样式组件
  },
  props: {
    isMul: { type: Boolean, default: false }
  },
  data() {
    return {
      curLabelName: this.labelName === "" ? "电话" : this.labelName
    };
  },
  methods: {
    outcall() {
      var parent = this.$utils.getHasFormFieldParentComponent(this);
      this.$refs.call.curPopupsVisible = true;
      this.$refs.call.formField.phone = this.modelText;
      this.$refs.call.formField.custName = parent.formField.custName;
    },
    sendMessg() {
      this.$refs.sendMsg.curPopupsVisible = true;
      this.$refs.sendMsg.formField.phone = this.modelText;
    },
    sendCode1() {
      let val = this.modelCode;
      let text = this.codeField;
      this.$emit("sendChangeCode", val, text);
      this.$emit("changeCode", val, text);
      this.$emit("changeblur", val);
      this.sendCode();
    },
    setInputWidth(span){
      switch(span){
        case 6:return '';
        case 12:return 'width:85%;line-height: 38px;';
      }
    },
    clearCodeSelect(){
       this.sendCode1()
    }
  }
};
</script>
